home *** CD-ROM | disk | FTP | other *** search
/ QuickTime 2.0 Beta / Quicktime 2.0 Beta.iso / Extensions / Macintosh Easy Open / Documentation / Developer / Interfaces / PInterfaces / Components.p next >
Encoding:
Text File  |  1993-04-28  |  8.0 KB  |  252 lines  |  [TEXT/MPS ]

  1. {
  2.     File:        Components.p
  3.  
  4.     Copyright:    © 1991-1993 by Apple Computer, Inc., all rights reserved.
  5. }
  6.  
  7.  
  8. {
  9. Created: Wednesday, August 14, 1991 at 12:11 PM
  10.  Components.p
  11.  Pascal Interface to the Macintosh Libraries
  12.  
  13.  Copyright Apple Computer, Inc. 1990 - 1991
  14.  All rights reserved
  15.  
  16. }
  17.  
  18.  
  19. {$IFC UNDEFINED UsingIncludes}
  20. {$SETC UsingIncludes := 0}
  21. {$ENDC}
  22.  
  23. {$IFC NOT UsingIncludes}
  24.  UNIT Components;
  25.  INTERFACE
  26. {$ENDC}
  27.  
  28. {$IFC UNDEFINED UsingComponents}
  29. {$SETC UsingComponents := 1}
  30.  
  31. {$I+}
  32. {$SETC ComponentsIncludes := UsingIncludes}
  33. {$SETC UsingIncludes := 1}
  34. {$IFC UNDEFINED UsingTypes}
  35. {$I $$Shell(PInterfaces)Types.p}
  36. {$ENDC}
  37. {$SETC UsingIncludes := ComponentsIncludes}
  38.  
  39. CONST
  40. kAnyComponentType =            0;
  41. kAnyComponentSubType =         0;
  42. kAnyComponentManufacturer =    0;
  43. kAnyComponentFlagsMask =    0;
  44.  
  45. cmpWantsRegisterMessage = $80000000;
  46.  
  47.  
  48. TYPE
  49. ComponentDescription = RECORD
  50.  componentType: OSType;                                { A unique 4-byte code indentifying the command set }
  51.  componentSubType: OSType;                            { Particular flavor of this instance }
  52.  componentManufacturer: OSType;                        { Vendor indentification }
  53.  componentFlags: LONGINT;                            { 8 each for Component,Type,SubType,Manuf/revision }
  54.  componentFlagsMask: LONGINT;                        { Mask for specifying which flags to consider in search, zero during registration }
  55.  END;
  56.  
  57. ResourceSpec = RECORD
  58.  resType: OSType;                                    { 4-byte code  }
  59.  resId: INTEGER;                                    {    }
  60.  END;
  61.  
  62. ComponentResourcePtr = ^ComponentResource;
  63. ComponentResourceHandle = ^ComponentResourcePtr;
  64. ComponentResource = RECORD
  65.  cd: ComponentDescription;                            { Registration parameters }
  66.  component: ResourceSpec;                            { resource where Component code is found }
  67.  componentName: ResourceSpec;                        { name string resource }
  68.  componentInfo: ResourceSpec;                        { info string resource }
  69.  componentIcon: ResourceSpec;                        { icon resource }
  70.  END;
  71.  
  72. { Structure received by Component:  }
  73. ComponentParameters = PACKED RECORD
  74.  flags: CHAR;                                        { call modifiers: sync/async, deferred, immed, etc }
  75.  paramSize: CHAR;                                    { size in bytes of actual parameters passed to this call }
  76.  what: INTEGER;                                        { routine selector, negative for Component management calls }
  77.  params: ARRAY [0..0] OF LONGINT;                    { actual parameters for the indicated routine }
  78.  END;
  79.  
  80.  
  81. Component = ^ComponentRecord;
  82. ComponentRecord = RECORD
  83.  data: ARRAY [0..0] OF LONGINT;
  84.  END;
  85.  
  86. ComponentInstance = ^ComponentInstanceRecord;
  87. ComponentInstanceRecord = RECORD
  88.  data: ARRAY [0..0] OF LONGINT;
  89.  END;
  90.  
  91.  
  92.  
  93. ComponentResult = LONGINT;
  94.  
  95. ComponentRoutine = LONGINT;
  96.  
  97. ComponentFunction = LONGINT;
  98.  
  99.  
  100.  
  101. { *******************************************************
  102. *                                                     *
  103. *              APPLICATION LEVEL CALLS                *
  104. *                                                     *
  105. *******************************************************
  106. * Component Database Add, Delete, and Query Routines 
  107. *******************************************************
  108.  }
  109. FUNCTION RegisterComponent(cd: ComponentDescription;componentEntryPoint: ComponentRoutine;
  110.  global: INTEGER;componentName: Handle;componentInfo: Handle;componentIcon: Handle): Component;
  111.  INLINE $7001,$A82A;
  112. FUNCTION RegisterComponentResource(tr: ComponentResourceHandle;global: INTEGER): Component;
  113.  INLINE $7012,$A82A;
  114. FUNCTION UnregisterComponent(aComponent: Component): OSErr;
  115.  INLINE $7002,$A82A;
  116.  
  117. FUNCTION FindNextComponent(aComponent: Component;looking: ComponentDescription): Component;
  118.  INLINE $7004,$A82A;
  119. FUNCTION CountComponents(looking: ComponentDescription): LONGINT;
  120.  INLINE $7003,$A82A;
  121.  
  122. FUNCTION GetComponentInfo(aComponent: Component;cd: ComponentDescription;
  123.  componentName: Handle;componentInfo: Handle;componentIcon: Handle): OSErr;
  124.  INLINE $7005,$A82A;
  125. FUNCTION GetComponentListModSeed: LONGINT;
  126.  INLINE $7006,$A82A;
  127.  
  128.  
  129. { *******************************************************
  130. * Component Instance Allocation and dispatch routines 
  131. *******************************************************
  132.  }
  133. FUNCTION OpenComponent(aComponent: Component): ComponentInstance;
  134.  INLINE $7007,$A82A;
  135. FUNCTION CloseComponent(aComponentInstance: ComponentInstance): OSErr;
  136.  INLINE $7008,$A82A;
  137.  
  138. FUNCTION GetComponentInstanceError(aComponentInstance: ComponentInstance): OSErr;
  139.  INLINE $700A,$A82A;
  140.  
  141.  
  142. {  direct calls to the Components  }
  143. FUNCTION ComponentFunctionImplemented(ci: ComponentInstance;ftnNumber: INTEGER): LONGINT;
  144.  INLINE $2F3C,$2,$FFFD,$7000,$A82A;
  145. FUNCTION GetComponentVersion(ci: ComponentInstance): LONGINT;
  146.  INLINE $2F3C,$0,$FFFC,$7000,$A82A;
  147.  
  148. CONST
  149.  
  150. {****************************************************
  151. *                                                    *
  152. *               CALLS MADE BY Components             *
  153. *                                                    *
  154. ******************************************************
  155. ******************************************************
  156. * Required Component routines
  157. ******************************************************}
  158.  
  159. kComponentOpenSelect = -1;                            { ComponentInstance for this open }
  160. kComponentCloseSelect = -2;                            { ComponentInstance for this close }
  161. kComponentCanDoSelect = -3;                            { selector # being queried }
  162. kComponentVersionSelect = -4;                        { no params }
  163. kComponentRegisterSelect = -5;                        { no params }
  164. kComponentTargetSelect = -6;                        { ComponentInstance for top of call chain }
  165.  
  166.  
  167. { *******************************************************
  168. * Component Management routines
  169. *******************************************************
  170.  }
  171. PROCEDURE SetComponentInstanceError(aComponentInstance: ComponentInstance;
  172.  theError: OSErr);
  173.  INLINE $700B,$A82A;
  174.  
  175. FUNCTION GetComponentRefcon(aComponent: Component): LONGINT;
  176.  INLINE $7010,$A82A;
  177. PROCEDURE SetComponentRefcon(aComponent: Component;theRefcon: LONGINT);
  178.  INLINE $7011,$A82A;
  179.  
  180. FUNCTION OpenComponentResFile(aComponent: Component): INTEGER;
  181.  INLINE $7015,$A82A;
  182. FUNCTION CloseComponentResFile(refnum: INTEGER): OSErr;
  183.  INLINE $7018,$A82A;
  184.  
  185.  
  186. { *******************************************************
  187. * Component Instance Management routines
  188. *******************************************************
  189.  }
  190. FUNCTION GetComponentInstanceStorage(aComponentInstance: ComponentInstance): Handle;
  191.  INLINE $700C,$A82A;
  192. PROCEDURE SetComponentInstanceStorage(aComponentInstance: ComponentInstance;
  193.  theStorage: Handle);
  194.  INLINE $700D,$A82A;
  195.  
  196. FUNCTION GetComponentInstanceA5(aComponentInstance: ComponentInstance): LONGINT;
  197.  INLINE $700E,$A82A;
  198. PROCEDURE SetComponentInstanceA5(aComponentInstance: ComponentInstance;
  199.  theA5: LONGINT);
  200.  INLINE $700F,$A82A;
  201.  
  202. FUNCTION CountComponentInstances(aComponent: Component): LONGINT;
  203.  INLINE $7013,$A82A;
  204.  
  205. {  useful helper routines for convenient method dispatching  }
  206. FUNCTION CallComponentFunction(params: ComponentParameters;func: ComponentFunction): LONGINT;
  207.  INLINE $70FF,$A82A;
  208. FUNCTION CallComponentFunctionWithStorage(storage: Handle;params: ComponentParameters;
  209.  func: ComponentFunction): LONGINT;
  210.  INLINE $70FF,$A82A;
  211. FUNCTION DelegateComponentCall(originalParams: ComponentParameters;
  212.  ci: ComponentInstance): LONGINT;
  213.  INLINE $7024,$A82A;
  214.  
  215. CONST
  216.  
  217. { Set Default Component flags }
  218. defaultComponentIdentical = 0;
  219. defaultComponentAnyFlags = 1;
  220. defaultComponentAnyManufacturer = 2;
  221. defaultComponentAnySubType = 4;
  222. defaultComponentAnyFlagsAnyManufacturer = defaultComponentAnyFlags+defaultComponentAnyManufacturer;
  223. defaultComponentAnyFlagsAnyManufacturerAnySubType = defaultComponentAnyFlags+defaultComponentAnyManufacturer+defaultComponentAnySubType;
  224.  
  225. FUNCTION SetDefaultComponent(aComponent: Component;flags: INTEGER): OSErr;
  226.  INLINE $701E,$A82A;
  227. FUNCTION  OpenDefaultComponent(componentType: OSType; componentSubType: OSType ) : ComponentInstance;
  228.  INLINE $7021,$A82A;
  229. FUNCTION CaptureComponent(capturedComponent: Component;capturingComponent: Component): Component;
  230.  INLINE $701C,$A82A;
  231. FUNCTION UncaptureComponent(aComponent: Component): OSErr;
  232.  INLINE $701D,$A82A;
  233.  
  234.  
  235. CONST
  236.  
  237. { errors from component manager & components }
  238. invalidComponentID = -3000;
  239. validInstancesExist = -3001;
  240. componentNotCaptured = -3002;
  241. componentDontRegister = -3003;
  242.  
  243. badComponentInstance = $80008001;
  244. badComponentSelector = $80008002;
  245.  
  246. {$ENDC} { UsingComponents }
  247.  
  248. {$IFC NOT UsingIncludes}
  249.  END.
  250. {$ENDC}
  251.  
  252.